<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>o2php-test</title>
<link rel="stylesheet" type="text/css" href="../misc/css/reset.css"  />
<script type="text/javascript" src="../misc/vendors/jquery/jquery_1.2.6.js"></script>
<script type="text/javascript" src="../misc/vendors/o2js/o2js.js"></script>
<script type="text/javascript" src="../misc/vendors/o2js/o2js_build.js"></script>
<style type="text/css">
*{
font-size:12px;
}
</style>
<script type="text/javascript">
var themeUrl = "<?=$themeUrl?>";
// url('home','index') 
</script>
</head>
<body>
<link rel="stylesheet" type="text/css" href="../misc/vendors/o2js/o2tree/o2tree.css"  />
<script type="text/javascript" src="../misc/vendors/o2js/o2tree/o2tree.js"></script>
 
<script type="text/javascript">
var trees ;
$().ready(function(){
	o2js.build('dhtml');
	o2js.build('debug');
	showLoading();
 
	trees = new o2Tree({
		bind:'zhoupeng',	       //绑定到哪个节点
		loadUrl: '<?=url('test','trees')?>',         //如果有值则 异步加载路径，每次送到后台 就一个  node  当前父亲节点ID	
		imgpath:'/misc/vendors/o2js/o2tree/images',
		rootText:'省市区',
		animate:true,
		lines:true,
		loadAsync:true,
		loadType:'post',
		baseParams:{
			'type':'province'
		},
		loadbBefore:function(obj,val){
			obj.setBaseParams({
				'type':val.text
			});
			result('数据开始加载:'+val.text);
		},
		loadEnd:function(obj,val,response){
			result('数据加载完成:'+val.text);
		},
		nodeChange:function(obj,val,response){
			result('选择变更到了:'+val.text);
		},
		nodeClick:function(obj,val,response){
			result('单击进行了:'+val.text);
		},
		nodeDblClick:function(obj,val,response){
			result('双击进行了:'+val.text);
		}
	}); 
	trees.load(); 
});
function result(str){
$('#result').append(str).append(' - ');
}
function getSelect(){
	var slt = trees.getSelect();
	debug(slt);
}
 
 
</script>

 
<input type="button" value="reload" onclick="trees.reload()" />
<input type="button" value="expandAll" onclick="trees.expandAll()" />
<input type="button" value="setSelect" onclick="trees.setSelect(0)" />
<input type="button" value="getSelect" onclick="getSelect()" />
<input type="button" value="collapseAll" onclick="trees.collapseAll()" />
<input type="button" value="expandLevel（展开到第二层）" onclick="trees.expandLevel(2)" />
<div style="border:1px dashed #FF3333;margin:10px;padding:10px; ">
	<div id="zhoupeng"> </div>
</div>
<div style="border:1px dashed #FF3333;margin:10px;padding:10px; ">
	 <div id="shit"> </div>
</div>
<div style="border:1px dashed #FF3333;margin:10px;padding:10px; ">
	<textarea id="result" style="height:200px;width:80%"></textarea>
</div>

</body>
</html>